package com.woniuxy.cloud.userassembly.param;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * @author 周川雄
 * @date 2022/1/1 18:47
 */
@Data
public class SaveUserParam implements Serializable {
    private static final long serialVersionUID = -1242493306307174690L;

    @NotBlank
    @Length(min = 3, message = "账号最低3位")
    @ApiModelProperty(value = "账号")
    private String userAccount;

    @NotBlank(message = "密码不能为空")
    @Length(min = 3, message = "密码最低3位")
    @ApiModelProperty(value = "密码")
    private String userPassword;

    @NotBlank
    /**
     * 验证手机号，空和正确的手机号都能验证通过<br/>
     * 正确的手机号由11位数字组成，第一位为1
     * 第二位为 3、4、5、7、8
     *
     */
    @Pattern(regexp = "1[3|4|5|7|8][0-9]\\d{8}", message = "手机号格式错误！")
    @NotBlank(message = "手机号不能为空！")
    @ApiModelProperty("手机号")
    private String userPhone;


    @NotBlank(message = "姓名不能为空！")
    @ApiModelProperty(value = "姓名")
    private String userName;

    @NotNull
    @ApiModelProperty(value = "是否普通用户,0是普通用户,1不是普通用户")
    private Integer isUser;
}
